﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace igflow
{
    class Menu
    {
        bool wrap = false;
        public string name;
        public int currentItemID;
        public List<string> Items;
        public Menu(string name)
        {
            this.name = name;
            currentItemID = 0;
            Items = new List<string>();
        }

        public string CurrentItem
        {
            get
            {
                return Items.ElementAt(currentItemID);
            }
        }

        public void Next()
        {
            int nextItem = currentItemID + 1;
            if (nextItem < Items.Count)
            {
                currentItemID = nextItem;
            }
            else
            {
                if (wrap)
                {
                    currentItemID = 0;
                }
            }
        }

        public void Previous()
        {
            int previousItem = currentItemID - 1;
            if (previousItem >= 0)
            {
                currentItemID = previousItem;
            }
            else
            {
                if (wrap)
                {
                    currentItemID = Items.Count - 1;
                }
            }
        }
    }
}
